<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('鉴定受理登记列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
	<div class="row">
		<div class="col-sm-12 search-collapse">
			<form id="formId">
				<div class="select-list">
					<ul>
						<li hidden>
							<label>送鉴单位：</label>
							<input type="text" name="sendUnit"/>
						</li>
						<li>
							<label>来文文号：</label>
							<input type="text" name="documentNum"/>
						</li>

						<li hidden>
							<label>状态：</label>
							<select name="auditStatus">
								<option value="5">通过</option>

							</select>
						</li>
						<!--<li>
                            <label>是否启用：</label>
                            <select name="isUse">
                                <option value="1">开启</option>
                                <option value="0">关闭</option>
                            </select>
                        </li>-->

						<li>
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</li>
					</ul>
				</div>
			</form>
		</div>

		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table"></table>
		</div>
	</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
	var editFlag = [[${@permission.hasPermi('publish:register:edit')}]];
	var removeFlag = [[${@permission.hasPermi('publish:register:remove')}]];

	var prefix = ctx + "publish/register";

	$(function() {
		var options = {
			url: prefix + "/list",
			modalName: "鉴定受理登记",
			showSearch: false,
			showRefresh: false,
			showToggle: false,
			showColumns: false,
			sortName: "createTime",
			sortOrder: "desc",
			columns: [{
				radio: true
			},
				{
					field: 'id',
					title: '编号',
					visible: false
				},

				{
					field: 'sendUnitId',
					title: '送鉴单位',
					visible: false
				},
				{
					field: 'sendUnit',
					title: '送鉴单位'
				},
				{
					field: 'title',
					title: '来文标题',
					visible: false
				},
				{
					field: 'documentNum',
					title: '来文文号'
				},
				{
					field: 'sendDate',
					title: '送鉴日期',
					formatter: function(value, row, index) {
						return value.substring(0,10);
					}
				},
				{
					field: 'category',
					title: '样本类别'
				},
				{
					field: 'acceptDate',
					title: '受理日期',
					formatter: function(value, row, index) {
						return value.substring(0,10);
					}
				},

				{
					field: 'groupLeader',
					title: '鉴定组长'
				},

]
		};
		$.table.init(options);
	});

	/* 用户状态显示 */
	function statusTools(row) {
		if (row.isUse == '0') {
			return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.id + '\')"></i> ';
		} else {
			return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.id + '\')"></i> ';
		}
	}

	/* 是否启用-关闭 */
	function disable(id) {
		$.modal.confirm("确认要关闭吗？", function() {
			$.operate.post(prefix + "/changeStatus", { "id": id, "isUse": '0' });
		})
	}

	/* 是否启用-开启 */
	function enable(id) {
		$.modal.confirm("确认要开启吗？", function() {
			$.operate.post(prefix + "/changeStatus", { "id": id, "isUse": '1' });
		})
	}

	/* 添加用户-选择用户-提交 */
	function submitHandler(index, layero) {
		// var rows = $.table.selectFirstColumns();
		var rows  = $("#bootstrap-table").bootstrapTable('getSelections');



		console.log(rows)
		if (rows.length == 0) {
			$.modal.alertWarning("请至少选择一条记录");
			return;
		}

		$.modal.close();
		// 父页面的方法
		// parent.selectUsers();
		// 父页面的变量
		parent.setReport(rows);
		//parent.$('#userids').html(rows.join());
	}



</script>
</body>
</html>